package com.real8.romemp.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class YearlyReportViewImpl extends Composite implements YearlyReportView {

	private static YearlyReportViewImplUiBinder uiBinder = GWT
			.create(YearlyReportViewImplUiBinder.class);

	interface YearlyReportViewImplUiBinder extends
			UiBinder<Widget, YearlyReportViewImpl> {
	}

	@UiField
	SpanElement yearBCSpan;
	@UiField
	SpanElement populationSpan;
	@UiField
	SpanElement armyUnitsSpan;
	@UiField
	SpanElement auxiliaSpan;
	@UiField
	SpanElement warshipsSpan;
	@UiField
	SpanElement marinesSpan;
	@UiField
	SpanElement merchantShipsSpan;
	@UiField
	SpanElement merchantsSpan;
	@UiField
	SpanElement shipBuildersSpan;
	@UiField
	SpanElement artisansSpan;
	@UiField
	SpanElement freeLabourSpan;
	@UiField
	SpanElement treasurySpan;
	@UiField
	SpanElement foodReserveSpan;
	@UiField
	SpanElement foodNeedSpan;

	public YearlyReportViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void showReport(int yearBC, int population, int armyUnits,
			int auxilia, int warships, int marines, int merchantShips,
			int merchants, int shipBuilders, int artisans, int freeLabour,
			int treasury, int foodReserve, int foodNeed) {
		yearBCSpan.setInnerText("" + yearBC);
		populationSpan.setInnerText("" + population);
		armyUnitsSpan.setInnerText("" + armyUnits);
		auxiliaSpan.setInnerText("" + auxilia);
		warshipsSpan.setInnerText("" + warships);
		marinesSpan.setInnerText("" + marines);
		merchantShipsSpan.setInnerText("" + merchantShips);
		merchantsSpan.setInnerText("" + merchants);
		shipBuildersSpan.setInnerText("" + shipBuilders);
		artisansSpan.setInnerText("" + artisans);
		freeLabourSpan.setInnerText("" + freeLabour);
		treasurySpan.setInnerText("" + treasury);
		foodReserveSpan.setInnerText("" + foodReserve);
		foodNeedSpan.setInnerText("" + foodNeed);
	}
}
